<?php

	/*
	 * Save settings, used as an AJAX call
	 *
	 * Variables:
	 * 	n (string) : variable name
	 * 	val (string) : value to set the setting to
	 *
	 * Returns: string (error - ok)
	 *
	 */

	// Table to transcribe HTML variables to system variables
	$setflds = array(
		"pdate"=>"party_date",
		"phour"=>"party_hour",
		"usenmrban"=>"ban_by_number",
		"usetxtban"=>"ban_by_content",
		"smsdelay"=>"sms_delay",
		"useoldsms"=>"sms_use_old",
		"smsnrrand"=>"sms_use_old_number"
	);



	if(isset($setflds[$_GET["n"]])){
		$sql = mysql_query('INSERT INTO smssettings (settingName, settingValue, settingDate) VALUES ("'.$setflds[$_GET["n"]].'", "'.mysql_real_escape_string(stripslashes($_GET["val"])).'", NOW()) ON DUPLICATE KEY UPDATE settingValue="'.mysql_real_escape_string(stripslashes($_GET["val"])).'"');
		echo "ok";
	}else{
		echo "error";
	}



?>